package com.zhenmyan.secdeal.controller;

import com.zhenmyan.secdeal.Enum.ResponseEnum;
import com.zhenmyan.secdeal.pojo.User;
import com.zhenmyan.secdeal.service.OrderService;
import com.zhenmyan.secdeal.vo.OrderDetailVo;
import com.zhenmyan.secdeal.vo.Response;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * description:
 *
 * @author 颜真明
 * @date 2023/5/11  6:41
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @ApiOperation("订单")
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @ResponseBody
    public Response detail(User user, Long orderId) {
        if (user == null) {
            return Response.error(ResponseEnum.SESSION_ERROR);
        }
        OrderDetailVo orderDetailVo = orderService.detail(orderId);
        return Response.success(orderDetailVo);
    }

}
